import mongoose from 'mongoose';
import * as config from '../config/index';
mongoose.connect(`${config.mongoConfig.host}/${config.mongoConfig.db}`);
mongoose.Promise = global.Promise;
mongoose.set('debug', true);
const db = mongoose.connection;
db.on('error', (err) => {
    console.log(err);
});
db.once('open', () => {
    console.log('mongo started');
});

global.ObjectId = mongoose.Types.ObjectId;